package usbcali.edu.persistencia.dto;

import usbcali.edu.persistencia.Salaxtforma;

import usbcali.edu.presentation.backEndBeans.SalaxtformaView;

import java.io.Serializable;
import java.math.BigDecimal;

import java.util.Date;

import javax.faces.event.ActionEvent;


/**
*
*
* @author Zathura Code Generator http://code.google.com/p/zathura
*
*/
public class SalaxtformaDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    private String capacidad;
    private String codSala_Salas;
    private String codSala;
    private String codTforma;
    private boolean rowSelected = false;
    private SalaxtformaView salaxtformaView;
    private Salaxtforma salaxtforma;

    public Salaxtforma getSalaxtforma() {
        return salaxtforma;
    }

    public String listener_update(ActionEvent e) {
        try {
            salaxtformaView.action_modifyWitDTO(((codSala == null) ||
                codSala.equals("")) ? null : new BigDecimal(codSala),
                ((codTforma == null) || codTforma.equals("")) ? null
                                                              : new String(
                    codTforma),
                ((capacidad == null) || capacidad.equals("")) ? null
                                                              : new Long(capacidad) );
            rowSelected = !rowSelected;
        } catch (Exception ex) {
            return "";
        }

        return "";
    }

    public void listener_cancel(ActionEvent e) {
        codSala = salaxtforma.getId().getCodSala().toString();
        codTforma = salaxtforma.getId().getCodTforma().toString();
        capacidad = (salaxtforma.getCapacidad() != null)
            ? salaxtforma.getCapacidad().toString() : null;
        codSala_Salas = (salaxtforma.getSalas().getCodSala() != null)
            ? salaxtforma.getSalas().getCodSala().toString() : null;
        rowSelected = !rowSelected;
    }

    /**
    * <p>Bound to commandLink actionListener in the ui that renders/unrenders
        * the Customer details for editing.</p>
        */
    public void toggleSelected(ActionEvent e) {
        codSala = salaxtforma.getId().getCodSala().toString();
        codTforma = salaxtforma.getId().getCodTforma().toString();
        capacidad = (salaxtforma.getCapacidad() != null)
            ? salaxtforma.getCapacidad().toString() : null;
        codSala_Salas = (salaxtforma.getSalas().getCodSala() != null)
            ? salaxtforma.getSalas().getCodSala().toString() : null;
        rowSelected = !rowSelected;
    }

    public void setSalaxtforma(Salaxtforma salaxtforma) {
        this.salaxtforma = salaxtforma;
    }

    public SalaxtformaView getSalaxtformaView() {
        return salaxtformaView;
    }

    public void setSalaxtformaView(SalaxtformaView salaxtformaView) {
        this.salaxtformaView = salaxtformaView;
    }

    public String getCapacidad() {
        return capacidad;
    }

    public void setCapacidad(String capacidad) {
        this.capacidad = capacidad;
    }

    public String getCodSala_Salas() {
        return codSala_Salas;
    }

    public void setCodSala_Salas(String codSala_Salas) {
        this.codSala_Salas = codSala_Salas;
    }

    public String getCodSala() {
        return codSala;
    }

    public void setCodSala(String codSala) {
        this.codSala = codSala;
    }

    public String getCodTforma() {
        return codTforma;
    }

    public void setCodTforma(String codTforma) {
        this.codTforma = codTforma;
    }

    public boolean isRowSelected() {
        return rowSelected;
    }

    public void setRowSelected(boolean rowSelected) {
        this.rowSelected = rowSelected;
    }
}
